Add vmlens interleaving analysis tests for StreamBuffer#106
Merged
Conversation
streambuffer already ran vmlens over the whole suite but had no dedicated VmlensInterleavingSmokeTest; add the same one the three sibling repos carry so the deterministic "is vmlens wired up?" baseline is identical across all four. - New net.ladenthin.streambuffer.vmlens.VmlensInterleavingSmokeTest: two threads increment a shared AtomicLong inside an AllInterleavings loop, asserting the sum is always 2. - pom: promote com.vmlens:api out of the vmlens profile into the main test <dependencies> (transitive-dep-free, convergence-safe) so the test compiles in every build; add a managed surefire <exclude> so the ordinary suite skips it (vacuous without the agent). The vmlens profile's whole-suite run still picks it up. Verified green under the vmlens agent. https://claude.ai/code/session_01HzCYFLjZZGFs4BsuUty35N
First real (beyond-smoke) vmlens target for this repo: a writer and a reader race on a StreamBuffer and the byte-accounting invariant totalBytesWritten == totalBytesRead + availableBytes must hold at quiescence for every interleaving. This covers the interleaving class neither existing tool reaches — Lincheck excludes read() (can't progress past a parked reader) and the jcstress close/unblock races assert only termination, not the resulting accounting (the reader's waitForAtLeast gate reads availableBytes/streamClosed outside bufferLock while the writer mutates them under it). - New net.ladenthin.streambuffer.vmlens.StreamBufferReaderWriterInterleavingTest. - pom: widen the managed surefire <exclude> to the whole vmlens package (**/vmlens/*.java) so new interleaving tests are auto-excluded from the ordinary suite; the vmlens profile's whole-suite run still picks them up. Verified green under the vmlens agent. https://claude.ai/code/session_01HzCYFLjZZGFs4BsuUty35N
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
VmlensInterleavingSmokeTest) demonstrating the vmlens setup with atomic operations, and a comprehensive reader/writer concurrency test (StreamBufferReaderWriterInterleavingTest) that verifies byte-accounting invariants under all thread interleavingsvmlensprofile with the vmlens agent)Details
The new tests provide deterministic interleaving coverage that complements existing concurrency testing:
VmlensInterleavingSmokeTest: A minimal baseline test that verifies two concurrent atomic increments always sum to two, demonstrating the vmlens setup is working correctly. Kept in sync with sibling repos.StreamBufferReaderWriterInterleavingTest: Drives a writer thread and reader thread through every possible interleaving and asserts the write/read/buffered byte-accounting invariant (totalBytesWritten == totalBytesRead + availableBytes) holds at quiescence. This covers the critical hand-off between the lock-free wait gate (waitForAtLeast) and lock-protected mutations that existing coverage (Lincheck, jcstress) does not reach.The vmlens API dependency is promoted from the
vmlensprofile to the main test classpath (it is transitive-dependency-free) so the smoke test compiles in every build, keeping it in sync with sibling repos. Execution is gated by thevmlensprofile and surefire exclusions; without the vmlens agent,AllInterleavings.hasNext()returns false and the loop body is skipped.Test plan
Related issues / PRs
Closes #18
Checklist
CONTRIBUTING.mdandCODE_OF_CONDUCT.mdhttps://claude.ai/code/session_01HzCYFLjZZGFs4BsuUty35N